GLOB is a special operator in SQLite that can be used to match text values against a pattern using wildcards. The GLOB operator is similar to the LIKE operator, but it has some important differences.
The GLOB operator is case-sensitive, while the LIKE operator is not. This means that the GLOB operator will only match text values that exactly match the pattern, while the LIKE operator will match text values that contain the pattern, regardless of case.
The GLOB operator also uses different wildcards than the LIKE operator. The GLOB operator uses the asterisk (*) wildcard to match any number of characters, and the question mark (?) wildcard to match any single character. The LIKE operator uses the percent (%) wildcard to match any number of characters, and the underscore (_) wildcard to match any single character.
Here are some examples of how the GLOB operator can be used:
Code snippet
SELECT * FROM table WHERE column GLOB '*.txt';
This query will select all rows from the table where the value in the column ends with .txt.
Code snippet
SELECT * FROM table WHERE column GLOB '*[0-9]';
This query will select all rows from the table where the value in the column contains a digit.
Code snippet
SELECT * FROM table WHERE column GLOB '[A-Z][a-z]';
This query will select all rows from the table where the value in the column starts with an uppercase letter and ends with a lowercase letter.
The GLOB operator is a powerful tool that can be used to match text values against patterns. It is a useful addition to the SQLite toolkit and can be used to simplify queries and improve performance.
In SQLite Database GLOB is an Operator like 'like' operator. GLOB operator is also used for matching string values values against patterns. GLOB operator works as a 'like' operator but the difference between both is that GLOB operator is case sensitive.
For example, if you want to fetch records from any column where name begins with the letter V. sqlite> SELECT * FROM EMPLOYEE WHERE NAME GLOB 'V*';
Liked By
Write Answer
What is GLOB in SQLite?
Join MindStick Community
You have need login or register for voting of answers or question.
Aryan Kumar
19-May-2023GLOB is a special operator in SQLite that can be used to match text values against a pattern using wildcards. The GLOB operator is similar to the LIKE operator, but it has some important differences.
The GLOB operator is case-sensitive, while the LIKE operator is not. This means that the GLOB operator will only match text values that exactly match the pattern, while the LIKE operator will match text values that contain the pattern, regardless of case.
The GLOB operator also uses different wildcards than the LIKE operator. The GLOB operator uses the asterisk (*) wildcard to match any number of characters, and the question mark (?) wildcard to match any single character. The LIKE operator uses the percent (%) wildcard to match any number of characters, and the underscore (_) wildcard to match any single character.
Here are some examples of how the GLOB operator can be used:
Code snippet
This query will select all rows from the table where the value in the column ends with .txt.
Code snippet
This query will select all rows from the table where the value in the column contains a digit.
Code snippet
This query will select all rows from the table where the value in the column starts with an uppercase letter and ends with a lowercase letter.
The GLOB operator is a powerful tool that can be used to match text values against patterns. It is a useful addition to the SQLite toolkit and can be used to simplify queries and improve performance.
Anonymous User
21-Sep-2015In SQLite Database GLOB is an Operator like 'like' operator. GLOB operator is also used for matching string values values against patterns. GLOB operator works as a 'like' operator but the difference between both is that GLOB operator is case sensitive.
For example, if you want to fetch records from any column where name begins with the letter V.
sqlite> SELECT * FROM EMPLOYEE WHERE NAME GLOB 'V*';